#include <iostream>
#include <vector>
using namespace std;

int lowbit(int x)
{
	return x & -x;
}

void add(vector<int> &nums, int x, int y)
{
	int n = nums.size();
	while (x < n) {
		nums[x] += y;
		x += lowbit(x);
	}
}

int sum(vector<int> &nums, int x)
{
	int ans = 0;
	while (x) {
		ans += nums[x];
		x -= lowbit(x);
	}
	return ans;
}

int range(vector<int> &nums, int l, int r)
{
	return sum(nums, r) - sum(nums, l - 1);
}

int main()
{
	int n = 0, m = 0;
	cin >> n >> m;
	vector<int> nums(n + 1, 0);

	for (int i = 1, v = 0; i <= n; i++) {
                cin >> v;
                add(nums, i, v);
	}

	for (int i = 0, op = 0, x = 0, y = 0; i < m; i++) {
		cin >> op >> x >> y;
		if (op == 1) {
			add(nums, x, y);
		} else {
			cout << range(nums, x, y) << endl;
		}
	}
	return 0;
}